import Vue from 'vue'

//组件
import Index from '@/page/index/index'

//企业详情查看
import Maplist from '@/page/map/maplist'
import Mapnearby from '@/page/map/mapnearby'
import Mapdetail from '@/page/map/mapdetail'


//内容页展示区域
const root = Vue.component('root', {
  template: '<router-view></router-view>'
});

let routes = [
  {
    path: '/',
    name: 'Index',
    component: Index,
    meta: {
      hidden: true
    }
  }, {
    path: '/',
    component: root,
    meta: {
      requiresAuth: true
    },
    children: [
    {
      //搜索
       path: 'maplist',
       name: 'Maplist',
       component: Maplist,
    },
    {
      //附近地图
       path: 'mapnearby',
       name: 'Mapnearby',
       component:Mapnearby,
    },  
    {
      //详情页
       path: 'mapdetail',
       name: 'Mapdetail',
       component:Mapdetail,
    }
  ]
  }
]


routes[1].children.forEach(route => {
  if (route.children) {
    if (!route.meta) {
      route.meta = {};
    }
    route.meta.children = route.children;
  }
});

export default routes;

